 // 时间戳转换
 function timestampToTime(timestamp: any,brief?:boolean) {
    if (timestamp === 0 || timestamp == null) {
      return "";
    } else { 
      var date = new Date(timestamp * 1000);
      var Y = date.getFullYear() + "-";
      var M =
        (date.getMonth() + 1 < 10
          ? "0" + (date.getMonth() + 1)
          : date.getMonth() + 1) + "-";
      var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
      var H = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
      var Min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
      var S = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
      
      if(brief){
        return Y + M + D  ;
      }else{
        return Y + M + D + ' '+  H + ':'+  Min ;
      }
    }
  }

 function Time(timestamp: any,value:string) {
   
      var date = new Date(timestamp * 1000);
      var Y = date.getFullYear() + "";
      var M =
        (date.getMonth() + 1 < 10
          ? "0" + (date.getMonth() + 1)
          : date.getMonth() + 1) + "";
      var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
      var H = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
      var Min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
      var S = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
      
      if(value=='Y'){
        return Y 
      }else if(value=='M'){
        return M 
      }
      else if(value=='D'){
        return D 
      }
      else {
        return Y + M + D + ' '+  H + ':'+  Min ;
      }
    
  }

  export {timestampToTime,Time}